Left Termination of the query pattern overlap_in_2(g, g) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

overlap(Xs, Ys) :- ','(member2(X, Xs), member1(X, Ys)).
has_a_or_b(Xs) :- overlap(Xs, .(a, .(b, []))).
member1(X, .(Y, Xs)) :- member1(X, Xs).
member1(X, .(X, Xs)).
member2(X, .(Y, Xs)) :- member2(X, Xs).
member2(X, .(X, Xs)).

Queries:

overlap(g,g).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
overlap_in: (b,b)
member2_in: (f,b)
member1_in: (b,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

overlap_in_gg(Xs, Ys) → U1_gg(Xs, Ys, member2_in_ag(X, Xs))
member2_in_ag(X, .(Y, Xs)) → U5_ag(X, Y, Xs, member2_in_ag(X, Xs))
member2_in_ag(X, .(X, Xs)) → member2_out_ag(X, .(X, Xs))
U5_ag(X, Y, Xs, member2_out_ag(X, Xs)) → member2_out_ag(X, .(Y, Xs))
U1_gg(Xs, Ys, member2_out_ag(X, Xs)) → U2_gg(Xs, Ys, member1_in_gg(X, Ys))
member1_in_gg(X, .(Y, Xs)) → U4_gg(X, Y, Xs, member1_in_gg(X, Xs))
member1_in_gg(X, .(X, Xs)) → member1_out_gg(X, .(X, Xs))
U4_gg(X, Y, Xs, member1_out_gg(X, Xs)) → member1_out_gg(X, .(Y, Xs))
U2_gg(Xs, Ys, member1_out_gg(X, Ys)) → overlap_out_gg(Xs, Ys)

The argument filtering Pi contains the following mapping:
overlap_in_gg(x1, x2)  =  overlap_in_gg(x1, x2)
U1_gg(x1, x2, x3)  =  U1_gg(x2, x3)
member2_in_ag(x1, x2)  =  member2_in_ag(x2)
.(x1, x2)  =  .(x1, x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
member2_out_ag(x1, x2)  =  member2_out_ag(x1)
U2_gg(x1, x2, x3)  =  U2_gg(x3)
member1_in_gg(x1, x2)  =  member1_in_gg(x1, x2)
U4_gg(x1, x2, x3, x4)  =  U4_gg(x4)
member1_out_gg(x1, x2)  =  member1_out_gg
overlap_out_gg(x1, x2)  =  overlap_out_gg

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

overlap_in_gg(Xs, Ys) → U1_gg(Xs, Ys, member2_in_ag(X, Xs))
member2_in_ag(X, .(Y, Xs)) → U5_ag(X, Y, Xs, member2_in_ag(X, Xs))
member2_in_ag(X, .(X, Xs)) → member2_out_ag(X, .(X, Xs))
U5_ag(X, Y, Xs, member2_out_ag(X, Xs)) → member2_out_ag(X, .(Y, Xs))
U1_gg(Xs, Ys, member2_out_ag(X, Xs)) → U2_gg(Xs, Ys, member1_in_gg(X, Ys))
member1_in_gg(X, .(Y, Xs)) → U4_gg(X, Y, Xs, member1_in_gg(X, Xs))
member1_in_gg(X, .(X, Xs)) → member1_out_gg(X, .(X, Xs))
U4_gg(X, Y, Xs, member1_out_gg(X, Xs)) → member1_out_gg(X, .(Y, Xs))
U2_gg(Xs, Ys, member1_out_gg(X, Ys)) → overlap_out_gg(Xs, Ys)

The argument filtering Pi contains the following mapping:
overlap_in_gg(x1, x2)  =  overlap_in_gg(x1, x2)
U1_gg(x1, x2, x3)  =  U1_gg(x2, x3)
member2_in_ag(x1, x2)  =  member2_in_ag(x2)
.(x1, x2)  =  .(x1, x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
member2_out_ag(x1, x2)  =  member2_out_ag(x1)
U2_gg(x1, x2, x3)  =  U2_gg(x3)
member1_in_gg(x1, x2)  =  member1_in_gg(x1, x2)
U4_gg(x1, x2, x3, x4)  =  U4_gg(x4)
member1_out_gg(x1, x2)  =  member1_out_gg
overlap_out_gg(x1, x2)  =  overlap_out_gg


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

OVERLAP_IN_GG(Xs, Ys) → U1_GG(Xs, Ys, member2_in_ag(X, Xs))
OVERLAP_IN_GG(Xs, Ys) → MEMBER2_IN_AG(X, Xs)
MEMBER2_IN_AG(X, .(Y, Xs)) → U5_AG(X, Y, Xs, member2_in_ag(X, Xs))
MEMBER2_IN_AG(X, .(Y, Xs)) → MEMBER2_IN_AG(X, Xs)
U1_GG(Xs, Ys, member2_out_ag(X, Xs)) → U2_GG(Xs, Ys, member1_in_gg(X, Ys))
U1_GG(Xs, Ys, member2_out_ag(X, Xs)) → MEMBER1_IN_GG(X, Ys)
MEMBER1_IN_GG(X, .(Y, Xs)) → U4_GG(X, Y, Xs, member1_in_gg(X, Xs))
MEMBER1_IN_GG(X, .(Y, Xs)) → MEMBER1_IN_GG(X, Xs)

The TRS R consists of the following rules:

overlap_in_gg(Xs, Ys) → U1_gg(Xs, Ys, member2_in_ag(X, Xs))
member2_in_ag(X, .(Y, Xs)) → U5_ag(X, Y, Xs, member2_in_ag(X, Xs))
member2_in_ag(X, .(X, Xs)) → member2_out_ag(X, .(X, Xs))
U5_ag(X, Y, Xs, member2_out_ag(X, Xs)) → member2_out_ag(X, .(Y, Xs))
U1_gg(Xs, Ys, member2_out_ag(X, Xs)) → U2_gg(Xs, Ys, member1_in_gg(X, Ys))
member1_in_gg(X, .(Y, Xs)) → U4_gg(X, Y, Xs, member1_in_gg(X, Xs))
member1_in_gg(X, .(X, Xs)) → member1_out_gg(X, .(X, Xs))
U4_gg(X, Y, Xs, member1_out_gg(X, Xs)) → member1_out_gg(X, .(Y, Xs))
U2_gg(Xs, Ys, member1_out_gg(X, Ys)) → overlap_out_gg(Xs, Ys)

The argument filtering Pi contains the following mapping:
overlap_in_gg(x1, x2)  =  overlap_in_gg(x1, x2)
U1_gg(x1, x2, x3)  =  U1_gg(x2, x3)
member2_in_ag(x1, x2)  =  member2_in_ag(x2)
.(x1, x2)  =  .(x1, x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
member2_out_ag(x1, x2)  =  member2_out_ag(x1)
U2_gg(x1, x2, x3)  =  U2_gg(x3)
member1_in_gg(x1, x2)  =  member1_in_gg(x1, x2)
U4_gg(x1, x2, x3, x4)  =  U4_gg(x4)
member1_out_gg(x1, x2)  =  member1_out_gg
overlap_out_gg(x1, x2)  =  overlap_out_gg
OVERLAP_IN_GG(x1, x2)  =  OVERLAP_IN_GG(x1, x2)
MEMBER1_IN_GG(x1, x2)  =  MEMBER1_IN_GG(x1, x2)
U1_GG(x1, x2, x3)  =  U1_GG(x2, x3)
MEMBER2_IN_AG(x1, x2)  =  MEMBER2_IN_AG(x2)
U4_GG(x1, x2, x3, x4)  =  U4_GG(x4)
U2_GG(x1, x2, x3)  =  U2_GG(x3)
U5_AG(x1, x2, x3, x4)  =  U5_AG(x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

OVERLAP_IN_GG(Xs, Ys) → U1_GG(Xs, Ys, member2_in_ag(X, Xs))
OVERLAP_IN_GG(Xs, Ys) → MEMBER2_IN_AG(X, Xs)
MEMBER2_IN_AG(X, .(Y, Xs)) → U5_AG(X, Y, Xs, member2_in_ag(X, Xs))
MEMBER2_IN_AG(X, .(Y, Xs)) → MEMBER2_IN_AG(X, Xs)
U1_GG(Xs, Ys, member2_out_ag(X, Xs)) → U2_GG(Xs, Ys, member1_in_gg(X, Ys))
U1_GG(Xs, Ys, member2_out_ag(X, Xs)) → MEMBER1_IN_GG(X, Ys)
MEMBER1_IN_GG(X, .(Y, Xs)) → U4_GG(X, Y, Xs, member1_in_gg(X, Xs))
MEMBER1_IN_GG(X, .(Y, Xs)) → MEMBER1_IN_GG(X, Xs)

The TRS R consists of the following rules:

overlap_in_gg(Xs, Ys) → U1_gg(Xs, Ys, member2_in_ag(X, Xs))
member2_in_ag(X, .(Y, Xs)) → U5_ag(X, Y, Xs, member2_in_ag(X, Xs))
member2_in_ag(X, .(X, Xs)) → member2_out_ag(X, .(X, Xs))
U5_ag(X, Y, Xs, member2_out_ag(X, Xs)) → member2_out_ag(X, .(Y, Xs))
U1_gg(Xs, Ys, member2_out_ag(X, Xs)) → U2_gg(Xs, Ys, member1_in_gg(X, Ys))
member1_in_gg(X, .(Y, Xs)) → U4_gg(X, Y, Xs, member1_in_gg(X, Xs))
member1_in_gg(X, .(X, Xs)) → member1_out_gg(X, .(X, Xs))
U4_gg(X, Y, Xs, member1_out_gg(X, Xs)) → member1_out_gg(X, .(Y, Xs))
U2_gg(Xs, Ys, member1_out_gg(X, Ys)) → overlap_out_gg(Xs, Ys)

The argument filtering Pi contains the following mapping:
overlap_in_gg(x1, x2)  =  overlap_in_gg(x1, x2)
U1_gg(x1, x2, x3)  =  U1_gg(x2, x3)
member2_in_ag(x1, x2)  =  member2_in_ag(x2)
.(x1, x2)  =  .(x1, x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
member2_out_ag(x1, x2)  =  member2_out_ag(x1)
U2_gg(x1, x2, x3)  =  U2_gg(x3)
member1_in_gg(x1, x2)  =  member1_in_gg(x1, x2)
U4_gg(x1, x2, x3, x4)  =  U4_gg(x4)
member1_out_gg(x1, x2)  =  member1_out_gg
overlap_out_gg(x1, x2)  =  overlap_out_gg
OVERLAP_IN_GG(x1, x2)  =  OVERLAP_IN_GG(x1, x2)
MEMBER1_IN_GG(x1, x2)  =  MEMBER1_IN_GG(x1, x2)
U1_GG(x1, x2, x3)  =  U1_GG(x2, x3)
MEMBER2_IN_AG(x1, x2)  =  MEMBER2_IN_AG(x2)
U4_GG(x1, x2, x3, x4)  =  U4_GG(x4)
U2_GG(x1, x2, x3)  =  U2_GG(x3)
U5_AG(x1, x2, x3, x4)  =  U5_AG(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 6 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

MEMBER1_IN_GG(X, .(Y, Xs)) → MEMBER1_IN_GG(X, Xs)

The TRS R consists of the following rules:

overlap_in_gg(Xs, Ys) → U1_gg(Xs, Ys, member2_in_ag(X, Xs))
member2_in_ag(X, .(Y, Xs)) → U5_ag(X, Y, Xs, member2_in_ag(X, Xs))
member2_in_ag(X, .(X, Xs)) → member2_out_ag(X, .(X, Xs))
U5_ag(X, Y, Xs, member2_out_ag(X, Xs)) → member2_out_ag(X, .(Y, Xs))
U1_gg(Xs, Ys, member2_out_ag(X, Xs)) → U2_gg(Xs, Ys, member1_in_gg(X, Ys))
member1_in_gg(X, .(Y, Xs)) → U4_gg(X, Y, Xs, member1_in_gg(X, Xs))
member1_in_gg(X, .(X, Xs)) → member1_out_gg(X, .(X, Xs))
U4_gg(X, Y, Xs, member1_out_gg(X, Xs)) → member1_out_gg(X, .(Y, Xs))
U2_gg(Xs, Ys, member1_out_gg(X, Ys)) → overlap_out_gg(Xs, Ys)

The argument filtering Pi contains the following mapping:
overlap_in_gg(x1, x2)  =  overlap_in_gg(x1, x2)
U1_gg(x1, x2, x3)  =  U1_gg(x2, x3)
member2_in_ag(x1, x2)  =  member2_in_ag(x2)
.(x1, x2)  =  .(x1, x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
member2_out_ag(x1, x2)  =  member2_out_ag(x1)
U2_gg(x1, x2, x3)  =  U2_gg(x3)
member1_in_gg(x1, x2)  =  member1_in_gg(x1, x2)
U4_gg(x1, x2, x3, x4)  =  U4_gg(x4)
member1_out_gg(x1, x2)  =  member1_out_gg
overlap_out_gg(x1, x2)  =  overlap_out_gg
MEMBER1_IN_GG(x1, x2)  =  MEMBER1_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

MEMBER1_IN_GG(X, .(Y, Xs)) → MEMBER1_IN_GG(X, Xs)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

MEMBER1_IN_GG(X, .(Y, Xs)) → MEMBER1_IN_GG(X, Xs)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

MEMBER2_IN_AG(X, .(Y, Xs)) → MEMBER2_IN_AG(X, Xs)

The TRS R consists of the following rules:

overlap_in_gg(Xs, Ys) → U1_gg(Xs, Ys, member2_in_ag(X, Xs))
member2_in_ag(X, .(Y, Xs)) → U5_ag(X, Y, Xs, member2_in_ag(X, Xs))
member2_in_ag(X, .(X, Xs)) → member2_out_ag(X, .(X, Xs))
U5_ag(X, Y, Xs, member2_out_ag(X, Xs)) → member2_out_ag(X, .(Y, Xs))
U1_gg(Xs, Ys, member2_out_ag(X, Xs)) → U2_gg(Xs, Ys, member1_in_gg(X, Ys))
member1_in_gg(X, .(Y, Xs)) → U4_gg(X, Y, Xs, member1_in_gg(X, Xs))
member1_in_gg(X, .(X, Xs)) → member1_out_gg(X, .(X, Xs))
U4_gg(X, Y, Xs, member1_out_gg(X, Xs)) → member1_out_gg(X, .(Y, Xs))
U2_gg(Xs, Ys, member1_out_gg(X, Ys)) → overlap_out_gg(Xs, Ys)

The argument filtering Pi contains the following mapping:
overlap_in_gg(x1, x2)  =  overlap_in_gg(x1, x2)
U1_gg(x1, x2, x3)  =  U1_gg(x2, x3)
member2_in_ag(x1, x2)  =  member2_in_ag(x2)
.(x1, x2)  =  .(x1, x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
member2_out_ag(x1, x2)  =  member2_out_ag(x1)
U2_gg(x1, x2, x3)  =  U2_gg(x3)
member1_in_gg(x1, x2)  =  member1_in_gg(x1, x2)
U4_gg(x1, x2, x3, x4)  =  U4_gg(x4)
member1_out_gg(x1, x2)  =  member1_out_gg
overlap_out_gg(x1, x2)  =  overlap_out_gg
MEMBER2_IN_AG(x1, x2)  =  MEMBER2_IN_AG(x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

MEMBER2_IN_AG(X, .(Y, Xs)) → MEMBER2_IN_AG(X, Xs)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
MEMBER2_IN_AG(x1, x2)  =  MEMBER2_IN_AG(x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

MEMBER2_IN_AG(.(Y, Xs)) → MEMBER2_IN_AG(Xs)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: